class Config(object):
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    SECRET_KEY = "you can not guess this stings"

    @staticmethod
    def init_app(app):
        # 可添加loggin setting模板
        pass


class DevelopmentConfig(Config):
    DEBUG = True
    # 追踪数据库的修改，如果不设置会警告，但并不影响代码执行
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    PRESERVE_CONTEXT_ON_EXCEPTION = False
    # 开启显示sql语句
    # SQLALCHEMY_ECHO = True
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:mysql@127.0.0.1:3306/sun?charset=utf8"


class TestConfig(Config):
    DEBUG = True
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    PRESERVE_CONTEXT_ON_EXCEPTION = False
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:mysql@127.0.0.1:3306/sun?charset=utf8"


class ProductConfig(Config):
    DEBUG = False
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    PRESERVE_CONTEXT_ON_EXCEPTION = False
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://root:mysql@127.0.0.1:3306/monitor?charset=utf8"


baseConfig = {
    'development': DevelopmentConfig,
    'product': ProductConfig,
    'default': DevelopmentConfig
}
